package businesslogic.Strategybl;

import PO.StrategyPO;
import VO.StrategyVO;
import util.UserType;

/**
 * 单个的策略类，vo、po的转换器
 * @author insomniaLee
 *
 */

public class StrategyItem {

    /**
     * 酒店用户名
     */
    private String hotelName;
    /**
     * 促销策略的所有者类型
     */
    private UserType userType;

    /**
     * 促销策略的名称
     */
    private String content;
    /**
     * 促销策略打折数
     */
    private double discount;
    /**构造函数*/
    public StrategyItem(StrategyVO strategyVO){
        this.hotelName=strategyVO.getHotelName();
        this.content=strategyVO.getContent();
        this.discount=strategyVO.getDiscount();
        this.userType=strategyVO.getUserType();
    }
    /**构造函数*/
    public StrategyItem(StrategyPO strategyPO){
        this.hotelName=strategyPO.getHotelName();
        this.content=strategyPO.getContent();
        this.discount=strategyPO.getDiscount();
        this.userType=strategyPO.getUserType();
    }

    /***
     * 将自身转化为一个po
     * @return StrategyPO
     */
    public StrategyPO strategyItemToPo(){

        return new StrategyPO(hotelName,userType,content,discount);
    }
    /***
     * 将自身转化为一个vo
     * @return StrategyVO
     */
    public StrategyVO strategyItemToVo(){

        return new StrategyVO(hotelName,userType,content,discount);
    }

    /***
     * 检查信息是否完整
     * @return 信息是否完整
     */
    public boolean isComplete(){
        if(content==null
                ||discount==-1
                ||hotelName==null
                ||userType==null){
            return false;
        }else{
            return true;
        }
    }

/**get set 方法*/
    public String getHotelName() {

        return hotelName;
    }

    public UserType getUserType() {

        return userType;
    }

    public String getContent() {

        return content;
    }

    public double getDiscount() {

        return discount;
    }

    public void setContent(String content) {

        this.content = content;
    }

    public void setDiscount(double discount) {

        this.discount = discount;
    }

    public void setHotelName(String hotelName) {

        this.hotelName = hotelName;
    }

    public void setUserType(UserType userType) {

        this.userType = userType;
    }
    /**get set方法结束*/
}
